package com.sean.reflect;

import com.sean.reference.Person;

import java.lang.reflect.*;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
      /*  Method[] methods = Person.class.getMethods();
        for(Method method:methods){
            System.out.println(method.getName());
        }
        Person.class.getConstructor(new Class[]{String.class});*/

     /*   Class  aClass = Person.class;

        Field field = aClass.getField("name");

        Person objectInstance = new Person("aa");

        Object value = field.get(objectInstance);

        field.set(objectInstance, "1313");*/

     /*   Method[] methods = Person.class.getMethods();
        for (Method method : methods) {
            System.out.println(method.getName());
        }
        Person.class.getConstructor(new Class[]{String.class});
*/

       /* Method method = MyClass.class.getMethod("getStringList", null);

        Type returnType = method.getGenericReturnType();


        if (returnType instanceof ParameterizedType) {
            ParameterizedType type = (ParameterizedType) returnType;
            Type[] typeArguments = type.getActualTypeArguments();
            for (Type typeArgument : typeArguments) {
                Class typeArgClass = (Class) typeArgument;
                System.out.println("typeArgClass = " + typeArgClass);
            }
     */


       /* Class stringArrayClass = Array.newInstance(String.class, 0).getClass();
        System.out.println("is array: " + stringArrayClass.isArray());*/

      /*  String[] strings = new String[3];
        Class stringArrayClass = strings.getClass();
        Class stringArrayComponentType = stringArrayClass.getComponentType();
        System.out.println(stringArrayComponentType);*/

       /* Field value = Boolean.class.getDeclaredField("value");
        value.setAccessible(true);
        value.set(Boolean.TRUE, new Boolean(false));
        value.set(Boolean.FALSE, new Boolean(true));
        System.out.printf("False == %s\n", false);
        if (Boolean.FALSE) {
            System.out.println("Hello World");
        }*/



    }
}
